Skip to content

Add AWS EC2 Instance Connect key upload detection - #4312

Open
themaryjo wants to merge 13 commits into
developfrom
aws-ec2-instance-connect-key-upload-detection
Open

themaryjo wants to merge 13 commits into
developfrom
aws-ec2-instance-connect-key-upload-detection

Conversation

@themaryjo

Copy link
Copy Markdown
Contributor

Adds an AWS CloudTrail behavioral detection for 10 or more successful EC2 Instance Connect SendSSHPublicKey calls by a single identity. The detection uses CIM-compatible fields and includes validated attack data and a passing unit test.

@patel-bhavin patel-bhavin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

text update needed

@nasbench nasbench added this to the v6.8.0 milestone Oct 2, 2026
@nasbench

nasbench commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-15T11:14:12.191295Z 1bf2a10 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9e04e6de5d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@splunk splunk deleted a comment from chatgpt-codex-connector Bot Oct 2, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9e04e6de5d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@nasbench nasbench modified the milestones: v6.8.0, v6.9.0 Oct 5, 2026
….yml

Group EC2 key uploads by AWS identity and count unique API events
patel-bhavin
patel-bhavin previously approved these changes Oct 8, 2026
@nasbench

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1bf2a1028f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

principal_json=json_extract(statements, "Principal")
| eval actions=if(match(actions_json, "^\s*\["), json_array_to_mv(actions_json, true()), actions_json)
| mvexpand actions
| where effect="Allow" AND actions="sts:AssumeRole"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Match wildcard grants of AssumeRole

When an external trust statement uses a valid wildcard action such as "sts:*" or "*", it still grants sts:AssumeRole, but this exact equality check discards the statement. An attacker can therefore create the external-trust role described by this detection without producing a result; the action test needs to account for IAM wildcard matching rather than only the canonical literal.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

….yml

since we are using "user_arn" in the detection, we should also use it in finding
Modified detection to handle wildcard IAM actions in external role trust detection
Comment thread detections/cloud/aws_ec2_startup_script_modified_on_stopped_instance.yml Outdated
replaced "actor" by "user_arn" for userIdentity.arn field

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants